package com.qf.smartplatform.task;

import com.google.common.collect.HashMultimap;
import com.qf.smartplatform.mapper.HumitureMapper;
import com.qf.smartplatform.pojo.Humiture;
import com.qf.smartplatform.websocket.MyHumiTempHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * projectName:day12_27_Test
 * author:guoLei
 * time:2022/1/10 14:43
 * description:
 */
@Component
public class HumitureTask {
    private HumitureMapper humitureMapper;

    @Autowired
    public void setHumitureMapper(HumitureMapper humitureMapper) {
        this.humitureMapper = humitureMapper;
    }

    @Scheduled(fixedRate = 90000)
    public void checkTemp() {
        System.err.println("开始计算温湿度的平均值了");

        HashMultimap<String, Humiture> humitureHashMultimap = MyHumiTempHandler.getHumitureHashMultimap();
        Map<String, Collection<Humiture>> asMap = humitureHashMultimap.asMap();
        HashMap<String, Collection<Humiture>> linshbianliang = new HashMap<>(asMap);



    }
}
